﻿<Window x:Class="MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:xcdg="clr-namespace:Xceed.Wpf.DataGrid;assembly=Xceed.Wpf.DataGrid"
        xmlns:Views="clr-namespace:Xceed.Wpf.DataGrid.Views;assembly=Xceed.Wpf.DataGrid"
        xmlns:me="clr-namespace:Co9320.NamaAlert"
        xmlns:corecnv="clr-namespace:Co9320.NamaAlert.Converter;assembly=Core"
        xmlns:mecnv="clr-namespace:Co9320.NamaAlert.Converter"
        xmlns:Behavior="clr-namespace:Co9320.NamaAlert.Behavior"
        xmlns:av="clr-namespace:Avalon.Windows.Controls;assembly=AvalonLibrary"
        Topmost="{Binding UISettings.Topmost}"
        Icon="application.ico"
        Width="720" Height="480">
    <Window.Title>
        <MultiBinding StringFormat="{}{0}/{1} - ニコ生アラート" >
            <Binding Path="AlertedProgramsCount" />
            <Binding Path="LivePrograms.Count" /> 
        </MultiBinding>
    </Window.Title>
    <Window.Resources>
        

        <!--<ResourceDictionary Source="/presentationframework.Luna;component/themes/luna.normalcolor.xaml" />-->
        <!--<ResourceDictionary Source="/presentationframework.Aero;component/themes/aero.normalcolor.xaml" />-->
        <!--<ResourceDictionary Source="/presentationframework.Classic;component/themes/classic.xaml" />-->

        <mecnv:GroupToImageConverter x:Key="GroupToImageConverter"/>

        <ContextMenu x:Key="AddMenu">
            <MenuItem Header="放送局の追加..." Command="{Binding ShowImportWindowCommand}" />
        </ContextMenu>
        
        <ContextMenu x:Key="ColumnMenu" StaysOpen="True">
            <MenuItem Header="アイコン" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.IconVisible}" Click="ColumnButtonMenu_Click" StaysOpenOnClick="True"/>
            <MenuItem Header="タイトル" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.TitleVisible}" Click="ColumnButtonMenu_Click" StaysOpenOnClick="True" />
            <MenuItem Header="放送局" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.StationNameVisible}" Click="ColumnButtonMenu_Click" StaysOpenOnClick="True" />
            <MenuItem Header="放送者" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.CasterVisible}" Click="ColumnButtonMenu_Click" StaysOpenOnClick="True" />
            <MenuItem Header="開始時間" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.StartDateTimeVisible}" Click="ColumnButtonMenu_Click" StaysOpenOnClick="True" />
            <MenuItem Header="経過時間" IsCheckable="True" IsEnabled="False" StaysOpenOnClick="True" />
            <MenuItem Header="来場者数" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.VisitorCountVisible}" Click="ColumnButtonMenu_Click" StaysOpenOnClick="True" />
            <MenuItem Header="コメ数" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.CommentCountVisible}" Click="ColumnButtonMenu_Click" StaysOpenOnClick="True" />
            <MenuItem Header="公式タグ" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.OfficialTagVisible}" Click="ColumnButtonMenu_Click" StaysOpenOnClick="True" />
            <MenuItem Header="詳細" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.ShortContentVisible}" Click="ColumnButtonMenu_Click" StaysOpenOnClick="True" />
            <MenuItem Header="評価" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.RatingVisible}" Click="ColumnButtonMenu_Click" StaysOpenOnClick="True" />
            <MenuItem Header="コミュニティ レベル" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.StationLevelVisible}" Click="ColumnButtonMenu_Click" StaysOpenOnClick="True" />
            <MenuItem Header="コミュニティ 参加メンバー数" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.StationMemberCountVisible}" Click="ColumnButtonMenu_Click" StaysOpenOnClick="True" />
            <MenuItem Header="放送局 更新日時" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.StationUpdaeDateTimeVisible}" Click="ColumnButtonMenu_Click" StaysOpenOnClick="True" />
            <MenuItem Header="通知設定" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.AlertMannersVisible}" Click="ColumnButtonMenu_Click" StaysOpenOnClick="True" />
        </ContextMenu>

        <ContextMenu x:Key="FilterMenu">
            <MenuItem Header="チャンネル" IsCheckable="True" IsChecked="{Binding Path=UISettings.DataGrid.FilterByChannel, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}" StaysOpenOnClick="True" />
            <MenuItem Header="コミュニティ" IsCheckable="True" IsChecked="{Binding Path=UISettings.DataGrid.FilterByCommunity, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}" StaysOpenOnClick="True" />
            <MenuItem Header="限定" IsCheckable="True" IsChecked="{Binding Path=UISettings.DataGrid.FilterByMemberOnly, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}" StaysOpenOnClick="True" />
            <MenuItem Header="顔出し" IsCheckable="True" IsChecked="{Binding Path=UISettings.DataGrid.FilterByFace, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}" StaysOpenOnClick="True" />
            <MenuItem Header="予約" IsCheckable="True" IsChecked="{Binding Path=UISettings.DataGrid.FilterByReserved, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}" StaysOpenOnClick="True" />
            <Separator />
            <MenuItem Header="通知対象" IsCheckable="True" IsChecked="{Binding Path=UISettings.DataGrid.FilterByAlertTarget, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}" StaysOpenOnClick="True" />
            <MenuItem Header="オンエア" IsCheckable="True" IsChecked="{Binding Path=UISettings.DataGrid.FilterByOnAir, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}" StaysOpenOnClick="True" />
            <MenuItem Header="オフエア" IsCheckable="True" IsChecked="{Binding Path=UISettings.DataGrid.FilterByOffAir, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}" StaysOpenOnClick="True" />
        </ContextMenu>

        <ContextMenu x:Key="RatingMenu" StaysOpen="True" IsEnabled="False">
            <MenuItem Header="星5" IsCheckable="True" IsChecked="{Binding Path=UISettings.FilterByStar5, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}" StaysOpenOnClick="True" />
            <MenuItem Header="星4" IsCheckable="True" IsChecked="{Binding Path=UISettings.FilterByStar4, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}" StaysOpenOnClick="True" />
            <MenuItem Header="星3" IsCheckable="True" IsChecked="{Binding Path=UISettings.FilterByStar3, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}" StaysOpenOnClick="True" />
            <MenuItem Header="星2" IsCheckable="True" IsChecked="{Binding Path=UISettings.FilterByStar2, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}" StaysOpenOnClick="True" />
            <MenuItem Header="星1" IsCheckable="True" IsChecked="{Binding Path=UISettings.FilterByStar1, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}" StaysOpenOnClick="True" />
            <MenuItem Header="評価なし" IsCheckable="True" IsChecked="{Binding Path=UISettings.FilterByStar0, Converter={StaticResource NegationConverter}}" Command="{Binding FilterCommand}" StaysOpenOnClick="True" />
            <!--<Separator />
            <MenuItem Header="すべて表示" IsCheckable="False" Command="{Binding UISettings.ResetFilterByStarCommand}" />-->
        </ContextMenu>

        <ContextMenu x:Key="GroupMenu">
            <MenuItem Header="なし" Command="{Binding UISettings.DataGrid.SetGroupCommand}" CommandParameter="None" StaysOpenOnClick="True">
                <MenuItem.Icon>
                    <Image Source="{Binding Path=UISettings.DataGrid.Group, Converter={StaticResource GroupToImageConverter}, ConverterParameter=None, Mode=OneWay}" Style="{StaticResource SmallIconStyle}" />
                </MenuItem.Icon>
            </MenuItem>
            <MenuItem Header="チャンネル/ユーザー放送" Command="{Binding UISettings.DataGrid.SetGroupCommand}" CommandParameter="Station" StaysOpenOnClick="True">
                <MenuItem.Icon>
                    <Image Source="{Binding Path=UISettings.DataGrid.Group, Converter={StaticResource GroupToImageConverter}, ConverterParameter=Station, Mode=OneWay}" Style="{StaticResource SmallIconStyle}" />
                </MenuItem.Icon>
            </MenuItem>
            <MenuItem Header="公式タグ" Command="{Binding UISettings.DataGrid.SetGroupCommand}" CommandParameter="OfficialTag" StaysOpenOnClick="True">
                <MenuItem.Icon>
                    <Image Source="{Binding Path=UISettings.DataGrid.Group, Converter={StaticResource GroupToImageConverter}, ConverterParameter=OfficialTag, Mode=OneWay}" Style="{StaticResource SmallIconStyle}" />
                </MenuItem.Icon>
            </MenuItem>
            <MenuItem Header="公開/限定" Command="{Binding UISettings.DataGrid.SetGroupCommand}" CommandParameter="MemberOnly" StaysOpenOnClick="True">
                <MenuItem.Icon>
                    <Image Source="{Binding Path=UISettings.DataGrid.Group, Converter={StaticResource GroupToImageConverter}, ConverterParameter=MemberOnly, Mode=OneWay}" Style="{StaticResource SmallIconStyle}" />
                </MenuItem.Icon>
            </MenuItem>
            <MenuItem Header="顔出し" Command="{Binding UISettings.DataGrid.SetGroupCommand}" CommandParameter="Face" StaysOpenOnClick="True">
                <MenuItem.Icon>
                    <Image Source="{Binding Path=UISettings.DataGrid.Group, Converter={StaticResource GroupToImageConverter}, ConverterParameter=Face, Mode=OneWay}" Style="{StaticResource SmallIconStyle}" />
                </MenuItem.Icon>
            </MenuItem>
            <MenuItem Header="評価" Command="{Binding UISettings.DataGrid.SetGroupCommand}" CommandParameter="Rating" StaysOpenOnClick="True">
                <MenuItem.Icon>
                    <Image Source="{Binding Path=UISettings.DataGrid.Group, Converter={StaticResource GroupToImageConverter}, ConverterParameter=Rating, Mode=OneWay}" Style="{StaticResource SmallIconStyle}" />
                </MenuItem.Icon>
            </MenuItem>
            <Separator />
            <MenuItem Header="アラートした放送をまとめる" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.GroupByAlertedProgram}" Command="{Binding UISettings.DataGrid.SetGroupCommand}" CommandParameter="{Binding UISettings.DataGrid.Group}" StaysOpenOnClick="True" />
            <MenuItem Header="通知対象の放送局をまとめる" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.GroupByAlertTarget}" Command="{Binding UISettings.DataGrid.SetGroupCommand}" CommandParameter="{Binding UISettings.DataGrid.Group}" StaysOpenOnClick="True" />
            <MenuItem Header="オフエアの放送局をまとめる" IsCheckable="True" IsChecked="{Binding UISettings.DataGrid.GroupByOffair}" Command="{Binding UISettings.DataGrid.SetGroupCommand}" CommandParameter="{Binding UISettings.DataGrid.Group}" StaysOpenOnClick="True" />
        </ContextMenu>

        <ContextMenu x:Key="SearchMenu">
            <MenuItem Header="大文字と小文字を区別する" IsCheckable="True" IsChecked="{Binding Path=UISettings.SearchOptions.IgnoreCase, Converter={StaticResource NegationConverter}}" />
            <MenuItem Header="半角と全角を区別する" IsCheckable="True" IsChecked="{Binding Path=UISettings.SearchOptions.IgnoreHalfwidth, Converter={StaticResource NegationConverter}}" />
            <MenuItem Header="ひらがなとカタカナを区別する" IsCheckable="True" IsChecked="{Binding Path=UISettings.SearchOptions.IgnoreKana, Converter={StaticResource NegationConverter}}" />
            <MenuItem Header="正規表現を使用する" IsCheckable="True" IsChecked="{Binding UISettings.SearchOptions.UseRegEx}" />
            <!--<Separator />
            <MenuItem Header="検索のヒント" IsEnabled="False" />-->
        </ContextMenu>

        <ContextMenu x:Key="SettingsMenu">
            <MenuItem Header="オプション(_O)..." Command="{Binding ShowOptionsWindowCommand}" />
        </ContextMenu>

        <ContextMenu x:Key="LinkMenu">
            <MenuItem Header="ニコニコ生放送(_L)" Command="{Binding OpenUriCommand}" CommandParameter="http://live.nicovideo.jp/">
                <MenuItem.Icon>
                    <Image Source="http://live.nicovideo.jp/img/favicon.ico" Style="{StaticResource SmallIconStyle}" />
                </MenuItem.Icon>
            </MenuItem>
            <MenuItem Header="番組表(_T)" Command="{Binding OpenUriCommand}" CommandParameter="http://live.nicovideo.jp/timetable">
                <MenuItem.Icon>
                    <Image Source="http://live.nicovideo.jp/img/favicon.ico" Style="{StaticResource SmallIconStyle}" />
                </MenuItem.Icon>
            </MenuItem>
            <MenuItem Header="ニコニ・コモンズ ニコ生アラート素材(_C)" Command="{Binding OpenUriCommand}" CommandParameter="http://www.niconicommons.jp/search/%E3%83%8B%E3%82%B3%E7%94%9F%E3%82%A2%E3%83%A9%E3%83%BC%E3%83%88">
                <MenuItem.Icon>
                    <Image Source="http://www.niconicommons.jp/favicon.ico" Style="{StaticResource SmallIconStyle}" />
                </MenuItem.Icon>
            </MenuItem>

        </ContextMenu>

        <ContextMenu x:Key="HelpMenu">
            <MenuItem Header="ヘルプ(_H)">
                <MenuItem.Icon>
                    <Image Source="Images/help_small.png" Style="{StaticResource SmallIconStyle}" />
                </MenuItem.Icon>
            </MenuItem>
            <Separator />
            <MenuItem Header="プログラミング生放送(_P)" Command="{Binding OpenUriCommand}" CommandParameter="http://ch.nicovideo.jp/community/co9320">
                <MenuItem.Icon>
                    <Image Source="http://ch.nicovideo.jp/img/favicon.ico" Style="{StaticResource SmallIconStyle}" />
                </MenuItem.Icon>
            </MenuItem>
            <MenuItem Header="ニコ生アラート - CodePlex(_C)" Command="{Binding OpenUriCommand}" CommandParameter="http://namaalert.codeplex.com/">
                <MenuItem.Icon>
                    <Image Source="http://namaalert.codeplex.com/favicon.ico" Style="{StaticResource SmallIconStyle}" />
                </MenuItem.Icon>
            </MenuItem>
            <Separator />
            <MenuItem Header="フィードバックの送信(_F)" />
            <MenuItem Header="バージョン情報(_A)..." />
        </ContextMenu>

    </Window.Resources>
    <Grid>
        <DockPanel>
            
            <Menu DockPanel.Dock="Top" Visibility="Visible">
                <MenuItem Header="ファイル(_F)">
                    <MenuItem Header="終了(_X)" Command="{Binding ShutdownApplicationCommand}"  />
                </MenuItem>
            </Menu>
            
            <Grid DockPanel.Dock="Top">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <ToolBarPanel HorizontalAlignment="Stretch">
                    <ToolBarTray>
                        <ToolBar ToolBarTray.IsLocked="True" x:Name="LeftSideToolBar">
                            <Button ToolTip="履歴">
                                <StackPanel Orientation="Horizontal" Margin="0">
                                    <Image Source="Images/bell_small.png" Style="{StaticResource SmallIconStyle}" />
                                    <Image Style="{StaticResource ToolBarArrowButtonStyle}" />
                                </StackPanel>
                            </Button>
                            <Button ToolTip="追加" Click="AddButton_Click">
                                <StackPanel Orientation="Horizontal" Margin="0">
                                    <Image Source="Images/bell-plus_small.png" Style="{StaticResource SmallIconStyle}" />
                                    <Image Style="{StaticResource ToolBarArrowButtonStyle}" />
                                </StackPanel>
                            </Button>
                            <Separator Margin="3" />
                            <ToggleButton ToolTip="通知オフ" IsChecked="{Binding UISettings.IsAlertOff}">
                                <Image Source="Images/bell-off_small.png" Style="{StaticResource SmallIconStyle}" />
                            </ToggleButton>
                            <ToggleButton ToolTip="ミュート" IsChecked="{Binding UISettings.IsMute}" >
                                <Image Source="Images/mute_small.png" Style="{StaticResource SmallIconStyle}" />
                            </ToggleButton>
                            <Button ToolTip="更新" IsEnabled="False">
                                <StackPanel Orientation="Horizontal" Margin="0">
                                    <Image Source="Images/arrow-circle-double_small.png" Style="{StaticResource SmallIconStyle}" />
                                    <Image Style="{StaticResource ToolBarArrowButtonStyle}" />
                                </StackPanel>
                            </Button>
                            <Separator Margin="3" />
                            <Button ToolTip="カラム" Click="ColumnButton_Click">
                                <StackPanel Orientation="Horizontal" Margin="0">
                                    <Image Source="Images/table_small.png" Style="{StaticResource SmallIconStyle}" />
                                    <Image Style="{StaticResource ToolBarArrowButtonStyle}" />
                                </StackPanel>
                            </Button>
                            <Button ToolTip="評価" Click="RatingButton_Click">
                                <StackPanel Orientation="Horizontal" Margin="0">
                                    <Image Source="Images/star_small.png" Style="{StaticResource SmallIconStyle}" />
                                    <Image Style="{StaticResource ToolBarArrowButtonStyle}" />
                                </StackPanel>
                            </Button>
                            <Button ToolTip="フィルタ" Click="FilterButton_Click">
                                <StackPanel Orientation="Horizontal" Margin="0">
                                    <Image Source="Images/funnel_small.png" Style="{StaticResource SmallIconStyle}" />
                                    <Image Style="{StaticResource ToolBarArrowButtonStyle}" />
                                </StackPanel>
                            </Button>
                            <Button ToolTip="グループ" Click="GroupButton_Click">
                                <StackPanel Orientation="Horizontal" Margin="0">
                                    <Image Source="Images/group_small.png" Style="{StaticResource SmallIconStyle}" />
                                    <Image Style="{StaticResource ToolBarArrowButtonStyle}" />
                                </StackPanel>
                            </Button>
                            <Separator Margin="3" />
                            <ToggleButton ToolTip="最前面に表示" IsChecked="{Binding UISettings.Topmost}">
                                <Image Source="Images/pin_small.png" Style="{StaticResource SmallIconStyle}" />
                            </ToggleButton>
                        </ToolBar>
                    </ToolBarTray>
                </ToolBarPanel>
                <ToolBarPanel Grid.Column="1">
                    <ToolBarTray HorizontalAlignment="Right">
                        <ToolBar ToolBarTray.IsLocked="True" x:Name="RightSideToolBar">
                            <Button ToolTip="設定" Click="SettingsButton_Click">
                                <StackPanel Orientation="Horizontal" Margin="0">
                                    <Image Source="Images/gear_small.png" Style="{StaticResource SmallIconStyle}" />
                                    <Image Style="{StaticResource ToolBarArrowButtonStyle}" />
                                </StackPanel>
                            </Button>
                            <Button ToolTip="リンク" Click="LinkButton_Click" IsEnabled="False">
                                <StackPanel Orientation="Horizontal" Margin="0">
                                    <Image Source="Images/link_small.png" Style="{StaticResource SmallIconStyle}" />
                                    <Image Style="{StaticResource ToolBarArrowButtonStyle}" />
                                </StackPanel>
                            </Button>
                            <Button ToolTip="ヘルプ" Click="HelpButton_Clieck" IsEnabled="False">
                                <StackPanel Orientation="Horizontal" Margin="0">
                                    <Image Source="Images/help_small.png" Style="{StaticResource SmallIconStyle}" />
                                    <Image Style="{StaticResource ToolBarArrowButtonStyle}" />
                                </StackPanel>
                            </Button>
                            
                            <Separator Margin="5 0 5 0"  />
                            
                            <ToggleButton ToolTip="タグ" IsChecked="{Binding UISettings.ShowTagBar}" IsEnabled="False">
                                <Image Source="Images/tag_small.png" Style="{StaticResource SmallIconStyle}" />
                            </ToggleButton>

                            <Separator Margin="5 0 5 0"  />

                            
                            <TextBox
                            Width="160" ToolTip="検索"
                            Text="{Binding SearchText, UpdateSourceTrigger=PropertyChanged}"
                            HorizontalAlignment="Stretch"
                            Margin="3 0 3 0"
                            Behavior:TextBoxBehavior.Command="{Binding SearchCommand}" />

                            <Button ToolTip="検索" Click="SearchButton_Click">
                                <Image
                                   Source="Images/magnifier_small.png" Style="{StaticResource SmallIconStyle}"
                                   HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0" />
                            </Button>
                            
                        </ToolBar>
                        
                    </ToolBarTray>
                </ToolBarPanel>
            </Grid>

            <!-- Status Bar -->
            <StatusBar DockPanel.Dock="Bottom">
                <StatusBar.ItemsPanel>
                    <ItemsPanelTemplate>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <!--<Grid.ColumnDefinitions>
                                <ColumnDefinition />
                                <ColumnDefinition Width="100"/>
                            </Grid.ColumnDefinitions>-->
                        </Grid>
                    </ItemsPanelTemplate>
                </StatusBar.ItemsPanel>

                <StatusBarItem>
                    <TextBlock Text="" />
                </StatusBarItem>

            </StatusBar>
            
            <xcdg:DataGridControl
                    x:Name="LiveProgramDataGrid"
                    EditTriggers="SingleClick"
                    CellEditorDisplayConditions="MouseOverCell"
                    ItemsSource="{Binding LiveProgramsViewSource.View}" 
                    AutoCreateColumns="False"
                    NavigationBehavior="RowOrCell"  
                    ItemScrollingBehavior="Immediate">

                <xcdg:DataGridControl.Resources>
                    <!--<Style x:Key="{x:Type xcdg:ScrollTip}" TargetType="xcdg:ScrollTip">
                        <Setter Property="HorizontalAlignment" Value="Right" />
                        <Setter Property="VerticalAlignment" Value="Center" />
                    </Style>-->
                    <Style TargetType="{x:Type xcdg:DataRow}">
                        <Setter Property="ContextMenu" Value="{StaticResource ProgramsRowContextMenu}" />
                    </Style>

                    <DataTemplate DataType="{x:Type xcdg:Group}">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Value}"/>
                            <TextBlock Text="("/>
                            <TextBlock Text="{Binding Items.Count}"/>
                            <TextBlock Text=")"/>
                        </StackPanel>
                    </DataTemplate>
                </xcdg:DataGridControl.Resources>

                <xcdg:DataGridControl.Columns>

                    <xcdg:Column FieldName="Icon" x:Name="IconColumn"
                                     ReadOnly="True"
                                     Title=""
                                     CellContentTemplate="{StaticResource StationIconCellTemplate}"                            
                                      />

                    <xcdg:Column FieldName="AlertManners" x:Name="AlertMannersColumn"
                                     ReadOnly="False"
                                     CellContentTemplate="{StaticResource TestCellTemplate}"
                                     CellEditor="{StaticResource AlertMannersCellEditor}"
                                     Title="通知設定">
                        <xcdg:Column.DisplayMemberBindingInfo>
                            <xcdg:DataGridBindingInfo Path="Station.AlertManners"  ReadOnly="False" />
                        </xcdg:Column.DisplayMemberBindingInfo>
                    </xcdg:Column>
                    <!-- CellEditor="{StaticResource AlertMannersCellEditor}" -->
                    <!--<xcdg:Column FieldName="TitleSubset" x:Name="TestColumn"
                                     ReadOnly="False"
                                     Title="Test" 
                                     >
                        <xcdg:Column.DisplayMemberBindingInfo> 
                            <xcdg:DataGridBindingInfo Path="Title" ReadOnly="True"   />
                        </xcdg:Column.DisplayMemberBindingInfo>
                    </xcdg:Column>-->

                    <xcdg:Column FieldName="Title" x:Name="TitleColumn"
                                     ReadOnly="True"
                                     Title="タイトル" 
                                     IsMainColumn="True"
                                     CellContentTemplate="{StaticResource TitleCellTemplate}"
                                     >
                        <xcdg:Column.DisplayMemberBindingInfo>
                            <xcdg:DataGridBindingInfo Path="Self" ReadOnly="True" />
                        </xcdg:Column.DisplayMemberBindingInfo>
                    </xcdg:Column>

                    <xcdg:Column FieldName="StationName" x:Name="StationNameColumn"
                                     ReadOnly="True"
                                     Title="放送局" />
                    <xcdg:Column FieldName="Caster" x:Name="CasterColumn"
                                     ReadOnly="True"
                                     Title="放送者" />
                    <xcdg:Column FieldName="StartDateTime" x:Name="StartDateTimeColumn"
                                     ReadOnly="True"
                                     CellContentTemplate="{StaticResource StartDateTimeCellTemplate}"
                                     Title="開始時間" />
                    <!--<xcdg:Column FieldName="ElapsedTime" x:Name="ElapsedTimeColumn"
                                     ReadOnly="True"
                                     CellContentTemplate="{StaticResource ElapsedTimeCellTemplate}"
                                     Title="経過時間" />-->
                    <xcdg:Column FieldName="VisitorCount" x:Name="VisitorCountColumn"
                                     ReadOnly="True"
                                     CellContentTemplate="{StaticResource NumberCellTemplate}"
                                     Title="来場者数" />
                    <xcdg:Column FieldName="CommentCount" x:Name="CommentCountColumn"
                                     ReadOnly="True"
                                     CellContentTemplate="{StaticResource NumberCellTemplate}"
                                     Title="コメ数" />
                    <xcdg:Column FieldName="OfficialTag" x:Name="OfficialTagColumn"
                                     ReadOnly="True"
                                     Title="公式タグ" />
                    <xcdg:Column FieldName="ShortContent" x:Name="ShortContentColumn"
                                     ReadOnly="True"
                                     Title="詳細" />
                    <xcdg:Column FieldName="Station" x:Name="RatingColumn"
                                     ReadOnly="False"
                                     CellContentTemplate="{StaticResource RatingCellTemplate}"
                                     CellEditor="{StaticResource RatingCellEditor}"
                                     Title="評価"
                                     />

                    <xcdg:Column FieldName="Level" x:Name="StationLevelColumn"
                                     ReadOnly="True"
                                     CellContentTemplate="{StaticResource NumberZeroSuppressCellTemplate}"
                                     Title="レベル" />
                    <xcdg:Column FieldName="MemberCount" x:Name="StationMemberCountColumn"
                                     ReadOnly="True"
                                     CellContentTemplate="{StaticResource NumberZeroSuppressCellTemplate}"
                                     Title="メンバー数" />
                    <xcdg:Column FieldName="UpdateDateTime" x:Name="StationUpdateDateTimeColumn"
                                     ReadOnly="True"
                                     CellContentTemplate="{StaticResource StartDateTimeCellTemplate}"
                                     Title="放送局 更新日時" />

                    <xcdg:Column FieldName="IsMemberOnly" x:Name="MemberOnlyColumn"
                                     CellContentTemplate="{StaticResource MemberOnlyCellTemplate}"
                                     ReadOnly="True"
                                     Visible="False"
                                     Title="公開" />
                    <xcdg:Column FieldName="IsFace" x:Name="FaceColumn"
                                     CellContentTemplate="{StaticResource FaceCellTemplate}"
                                     ReadOnly="True"
                                     Visible="False"
                                     Title="顔出し" />
                    <xcdg:Column FieldName="Group"
                                     ReadOnly="True"
                                     Visible="False"
                                     Title="グループ">
                    </xcdg:Column>

                </xcdg:DataGridControl.Columns>



                <xcdg:DataGridControl.View>


                    <Views:TableView UseDefaultHeadersFooters="True" IsAlternatingRowStyleEnabled="True" VerticalGridLineThickness="1" ShowRowSelectorPane="False">
                        <Views:TableView.FixedHeaders>
                            <!--<DataTemplate>
                                <xcdg:ColumnManagerRow />
                            </DataTemplate>-->
                        </Views:TableView.FixedHeaders>
                    </Views:TableView>
                </xcdg:DataGridControl.View>
            </xcdg:DataGridControl>


            
        </DockPanel>

        <av:NotifyIcon x:Name="NotifyIcon" 
                       Icon="application.ico" 
                       Visibility="Hidden"
                       >
            <!--<av:NotifyIcon.ContextMenu>
                <ContextMenu ItemsSource="{DynamicResource ContextMenuDataContext}" >
                    <ContextMenu.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel>
                                <ItemsPresenter />
                            </StackPanel>
                        </ItemsPanelTemplate>
                    </ContextMenu.ItemsPanel>
                    <ContextMenu.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Title}" />
                        </DataTemplate>
                    </ContextMenu.ItemTemplate>


                    <MenuItem Header="開く"  />
                    <Separator />
                    <MenuItem Header="終了"  />
                </ContextMenu>

            </av:NotifyIcon.ContextMenu>-->
        </av:NotifyIcon>
    </Grid>

</Window>